<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>代码怎样写才能找到文档装载后新建的节点？</title>

<script type="text/javascript" src="../js/jquery-1.4.2.js"></script>
<script type="text/javascript">

$(document).ready ( function () {
		$("div#nihao").append("<table><tr><td>nihao</td></tr><tr><td><a id=\"second\" href=\"\">Google2</a></td></tr></table>");
		$("div#nihao").append("<a id=\"third\" href=\"\">Google3</a>");
		//css方法貌似放到ready里面才能会在IE6下产生效果！
		$("#third").css("background", "#c5c5c5");
		//live放在ready里面和放在ready外面对于IE6会产生不同的效果
		$("#second").live ( "click",  function (event) {
			alert("nihao");
			event.preventDefault();
		});
		});

</script>

<style type="text/css">
</style>
</head>

<body>

<div id="nihao">
<a id="first" href="">Google1</a>
</div>

<script type="text/javascript">
$("#second").click (function (event) {
		alert("nihao");
		event.preventDefault();
		});
$("#first").click (function (event) {
		alert("nihao");
		event.preventDefault();
		});
</script>

</body>
</html>



